var cutter = new jQuery.UtrialAvatarCutter({
		content : "big",
		purviews : [{id:"medium",width:120,height:120}, {id:"small",width:50,height:50}],
		selector : {width:120,height:120}
	});

	$(window).load(function(){
		cutter.init();
		$("#save").click(function(){
				var data = cutter.submit();
				$.post("userAction!modifyPhoto", 
						{ 
						"imageBean.left": data.x,
						"imageBean.top": data.y, 
						"imageBean.width": data.w, 
						"imageBean.height": data.h, 
						"imageBean.url": data.s, 
						"user.id": $("#userId").val(), 
						"user.album": $("#userAlbum").val()
						}, 
						function(data) {
							window.location.href = "../jsp/upload.jsp";
						});
			});
	});
	$(function(){
		 $('#up').uploadify ({
	        'uploader': '../js/uploadify.swf',
	        'script': 'pictureAction!uploadPhoto?user.album=' + $("#userAblum").val(),
	        'cancelImg' : '../images/cancel.png',  
	        'fileDataName':'up',
	        'auto': false,
	        'folder': '/photos',
	        'fileExt': '*.png;*.gif;*.jpg;*.bmp;*.jpeg',  
	        'fileDesc': '图片文件(*.png;*.gif;*.jpg;*.bmp;*.jpeg)', 
	        'queueSizeLimit' : 5,
	        'sizeLimit': 99999999999,
	        'multi': true,
	        'simUploadLimit' : 1,
	        onComplete: function(event,queueID,fileObj,response,data) {
	        	cutter.reload("../" + response);
	        	$("#big img").attr('src', "../" + response);
	        	$("#loading").hide();
		 	},
		 	'buttonText': "Select Photo", 
		 	onSelectOnce     : function() {
	 	 		$("#loading").show();
	 	 	}
	    });
	});